package cn.tedu.micro.demo.order.controller;

import cn.tedu.micro.demo.common.protocol.JsonResult;
import cn.tedu.micro.demo.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class OrderController {
    /**
     * param:Integer gunId ,Integer userId
     * path:/order/create
     * 请求方式:form表单
     * 返回值: JsonResult<String>
     */
    @Autowired
    private OrderService orderService;
    @PostMapping("/order/create")
    public JsonResult<String> createOrder(Integer gunId, Integer userId){
        log.info("开始处理创建订单，参数:gunId={}，userId={}",gunId,userId);
        String billId = orderService.createOrder(gunId,userId);
        return JsonResult.success(billId);
    }
}
